import cache from "@/utils/cache.js";
import { ElMessage } from "element-plus";
import MJCrequesting from "@/service/index.js";
const system = {
  namespaced: true,
  state: {
    UserList: [],
    UserCount: 0,
  },
  mutations: {
    changeUserList(state, UserList) {
      state.UserList = UserList;
    },
    changeUserListTotal(state, count) {
      state.UserCount = count.count;
    },
  },
  getters: {},
  actions: {
    async getUserPageList({ commit }, payload) {
      const { pageUrl, queryInfo } = payload;
      const result = await MJCrequesting.request({
        url: pageUrl,
        data: queryInfo,
        method: "post",
      });
      commit("changeUserList", result.data);
      // commit("changeUserCount", totalCount);
    },
    async getUserTotal({ commit }, payload) {
      const { pageUrl } = payload;
      const result = await MJCrequesting.request({
        url: pageUrl,
        method: "GET",
      });
      commit("changeUserListTotal", result.data);
    },
  },
};

export default system;
